package com.stylefeng.guns.modular.VpnUserAnalyze.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.system.model.VpnUserAnalyze;
import com.stylefeng.guns.modular.VpnUserAnalyze.service.IVpnUserAnalyzeService;

/**
 * 用户分析 控制器
 *
 * @author fengshuonan
 * @Date 2020-04-13 15:58:57
 */
@Controller
@RequestMapping("/vpnUserAnalyze")
public class VpnUserAnalyzeController extends BaseController {

    private String PREFIX = "/VpnUserAnalyze/vpnUserAnalyze/";

    @Autowired
    private IVpnUserAnalyzeService vpnUserAnalyzeService;

    /**
     * 跳转到用户分析 首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "vpnUserAnalyze.html";
    }

    /**
     * 获取用户分析 列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        return vpnUserAnalyzeService.selectList(null);
    }

    /**
     * 注册用户的IP
     * @return
     */
    @RequestMapping(value = "/userIPList")
    @ResponseBody
    public Object userIPs(){
        return vpnUserAnalyzeService.getRegisterUserIPLocations();
    }

    /**
     * 获取各个版本的分布情况
     * @return
     */
    @RequestMapping(value = "/versionDistribution")
    @ResponseBody
    public Object versionDistribution(){
        return vpnUserAnalyzeService.getVersionDistribution();
    }

    /**
     * 获取各个平台的注册用户数量
     * @return
     */
    @RequestMapping(value = "/platformCount")
    @ResponseBody
    public Object platformCount(){
        return vpnUserAnalyzeService.getPlatformCount();
    }

    /**
     * VPN服务器连接信息分析数据
     * @return
     */
    @RequestMapping(value = "/serverConnectInfo")
    @ResponseBody
    public Object serverConnectInfo(){
        return vpnUserAnalyzeService.getConnectServerInfo();
    }

    /**
     * 用户付费率
     * @return 付费用户数量，总注册用户数
     */
    @RequestMapping(value = "/paymentRatio")
    @ResponseBody
    public Object paymentRatio(){
        return vpnUserAnalyzeService.queryPayRatio();
    }
}
